package com.naiterui.ehp.bs.recommend.controller.assist;


import com.naiterui.common.repository.page.PageParamVO;
import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.recommend.service.IAssistService;
import com.naiterui.ehp.bs.recommend.swagger.Tags;
import com.naiterui.ehp.bs.recommend.vo.assist.DrRevisitVO;
import com.naiterui.ehp.bs.recommend.vo.assist.PtRevisitVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 复诊相关
 *
 * @author gaoliangliang
 * @date 2019-06-19 10:10
 * @since 1.0.0
 */
@Api(tags = {SwaggerTag.PATIENT + SwaggerTag.MEDICINE_REMIND})
@RestController
@RequestMapping("recommend/revisit")
public class RevisitController {

    private final IAssistService assistService;

    public RevisitController(IAssistService assistService) {
        this.assistService = assistService;
    }


    @GetMapping("patient")
    @ApiOperation(tags = { Tags.RECOMMEND_ASSIST, Tags.WX }, value = "患者端随访提醒明细", notes = "患者端随访提醒明细", httpMethod = "GET")
    @ApiImplicitParams({ @ApiImplicitParam(name = "doctorId", value = "医生ID", required = true, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "patientId", value = "患者ID", required = true, dataType = "long", paramType = "query") })
    public ResponseVO<PtRevisitVO> ptRevisit(Long doctorId, Long patientId) throws BusinessException {
        PtRevisitVO ptRevisitVO = assistService.ptRevisit(doctorId, patientId);
        return PublicService.returnResponseVO(ptRevisitVO);
    }


    @GetMapping("doctor")
    @ApiOperation(tags = { Tags.RECOMMEND_ASSIST, Tags.APP }, value = "医生端复诊列表", notes = "医生端复诊列表", httpMethod = "GET")
    @ApiImplicitParams({ @ApiImplicitParam(name = "doctorId", value = "医生ID", required = true, dataType = "long", paramType = "query") })
    public ResponseVO<PageVO<DrRevisitVO>> drRevisit(Long doctorId, PageParamVO pageParamVO) {
        PageVO<DrRevisitVO> drRevisitPageVO = assistService.drRevisit(doctorId, pageParamVO.getPageable());
        return PublicService.returnResponseVO(drRevisitPageVO);
    }
}
